Page({
  total: 0,
  data: {
    subject: '',
    total: 3,
    titles: [
      {
      userSelect: '',
      title: '1+1=',
      current: '1',
      answer: 'B',
      options:[{
          code: 'A',
          option: '1'
        },{
          code: 'B',
          option: '2'
        },{
          code: 'C',
          option: '3'
        },{
          code: 'D',
          option: '4'
        }
      ]},
      {
        title: '1+2=',
        current: '2',
        answer: 'C',
        options:[{
            code: 'A',
            option: '1'
          },{
            code: 'B',
            option: '2'
          },{
            code: 'C',
            option: '3'
          },{
            code: 'D',
            option: '4'
          }
        ]},
    ]
  },
  onLoad(e){
    let sub = data.titles[0].current
    this.setData({
      total: this.data.titles.length,
      subject: subject
    })
  },
  submit(){
    let a = this.data.userSelect
     if(a == this.data.titles[0].answer){
       wx.showToast({
         icon: "success",
         title: 'yes',
       })
     }else{
       wx.showToast({
         icon: "error",
         title: 'no',
       })
     }
  },
  radioChange:function(e){
    this.setData({
      userSelect: e.detail.value
    })
  }
})